package com.stox.ui.javafx.core.widget;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;

import org.springframework.stereotype.Component;

@Component
public class WindowButtons extends HBox {

	public WindowButtons() {
		setId("window-buttons-hbox");
		Button closeBtn = new Button();
		closeBtn.getStyleClass().add("close");
		closeBtn.setOnAction(new EventHandler<ActionEvent>() {
			public void handle(ActionEvent actionEvent) {
				System.exit(0);
			}
		});
		Button minBtn = new Button();
		minBtn.getStyleClass().add("min");
		minBtn.setOnAction(new EventHandler<ActionEvent>() {
			public void handle(ActionEvent actionEvent) {
				StoxStage.getInstance().setIconified(true);
			}
		});
		Button maxBtn = new Button();
		maxBtn.getStyleClass().add("max");
		maxBtn.setOnAction(new EventHandler<ActionEvent>() {
			public void handle(ActionEvent actionEvent) {
				StoxStage.getInstance().toogleMaximized();
			}
		});
		getChildren().addAll(new Node[] { minBtn, maxBtn,closeBtn});
	}

}
